/*
 * DBPool.java
 *
 * Created on July 12, 2006, 10:29 AM
 *
 * Class will extend the dbConnection broker to use connection pooling.
 */

package com.asaga.tools;

import com.javaexchange.dbConnectionBroker.*;
import java.io.*;

/**
 *
 * @author mmixon
 */
public class DBPool extends DbConnectionBroker{
    
    private static DBPool pool = null;
    
    private DBPool(String driverName, String dbUrl, String username,
            String password, int minConns, int maxConns, String logFilename,
            double maxConnTimeInDays) throws IOException{
        super(driverName, dbUrl, username, password, minConns, maxConns,
                logFilename, maxConnTimeInDays);
    }
    /** Creates a new instance of DBPool */
    public synchronized static DBPool getInstance() {
        try{
            if(pool == null){
                pool = new DBPool(
                        "org.gjt.mm.mysql.Driver",
                        "jdbc:mysql://blackbear.ecology.uga.edu:3306/autismdb", "username", 
                        "password", 10, 50, "/path/to/log/file/connection.log", 1.0);
            }
        }
        catch(IOException ioe){
            System.err.println("DBPool IOException: " + ioe.getMessage());
        }
        return pool;
    }
    
}
